<?php
/**
 * Created by PhpStorm.
 * User: lee
 * Date: 2018/5/11
 * Time: 下午9:17
 */
namespace Biz\tools;

class ImageRule{
    public static function detectToJson(&$str){
        if(!empty($str)) {
            if (!is_null(json_decode($str))) {
                $a = json_decode($str,true);
                if(empty($a)){
                    $str = '';
                }
            }else{
                $a = explode(',', $str);
                $str = json_encode($a,JSON_UNESCAPED_UNICODE);
            }
        }
    }
}